Skip to content

New test tools - #622

Merged
waylan merged 3 commits into
Python-Markdown:masterfrom
waylan:newtests
Jan 9, 2018
Merged

waylan merged 3 commits into
Python-Markdown:masterfrom
waylan:newtests

Conversation

@waylan

@waylan waylan commented Jan 6, 2018

Copy link
Copy Markdown
Member

The new test tools are designed to both be used by Python-Markdown and by third party extensions. As all tests are based on the Python standard lib unittest, no third party dependencies exist (we no longer rely on nose). See the included documentation for the details.

The following is my proposal for how we should proceed with Python-Markdown's tests going forward:

Any new syntax tests for Python-Markdown should be developed with the markdown.test_tools.TestCase class. Any old file-based tests which need updating should be converted to this new type of test. A few new tests have been included with this PR and can be found in the tests/test_syntax directory. That directory should contain two subdirs: block and inline. The block subdir should contain files of tests for block-level elements and the inline subdir should contain files of tests for inline-level elements. Each file should contain tests for a single type of element.

The old file-based tests still exist but are now wrapped in markdown.test_tools.LegacyTestCase class instances. All of the wrapping classes, which include all of the settings and config for each tests are contained in the tests/test_legacy.py file. Over time, as these tests get moved to the new format, they should be removed from the legacy tests (none have been removed yet). Eventually, only the Perl and PHP test suites should remain (no edits should happen to those test files; if a test won't pass for good reason, then it should be skipped as some already are).

Any and all feedback is welcome.

As a part of the Markdown lib, test tools can be used by third party
extensions. Also keeps test dir clean as it only contains actual tests.
More work in this vein to come as the need for Nose is removed.

Tests are defined as Unittests rather than in text files  allowing
features to be more easily broken into units and run individually.
Based completely on standard lib unittest with no external dependencies.
Use `python -m unittest tests.test_syntax` to run.

Pulled some tests from https://github.com/karlcow/markdown-testsuite.
Many more test units to pull from that source. As we encounter the need
to edit an existing textfile-based test, or add a new test, a new test
should be created with this framework and the old test should be
deleted. Also need to delete existing testfile-based tests which are
covered in the new tests included here.
@waylan
waylan force-pushed the newtests branch 2 times, most recently from d804c84 to c7a23ff Compare January 7, 2018 00:16
@waylan

waylan commented Jan 7, 2018

Copy link
Copy Markdown
Member Author

Hmm, it seems that Travis has had a lot of jobs time-out recently. Usually it is somewhere in the setup process (downloading deps or similar). If I restart them they run fine. Anyone else seeing that?

@facelessuser

facelessuser commented Jan 7, 2018 •

Copy link
Copy Markdown
Collaborator

Yes. Right around the new year, Travis went to crap. It's been timeouts since on multiple of my repos. So it's not specific to this repo.

waylan added 2 commits January 8, 2018 20:08
All file-based tests are now defined as unittest test cases via a
metaclass which walks a directory and builds a unittest for each pair
of test files.

To run the tests just run `python -m unittest discover tests`. Or use
tox as the tox config has been updated to run the new tests and all nose
specific code has been removed.

The test generator tools have been removed as well. If any changes or
additions need to be made to tests, they should be implemented using
the new framework rather than with the file-based tests. Eventually,
only the PHP and pl tests should remain as file-based tests.
@waylan
waylan merged commit 9ea0e31 into Python-Markdown:master Jan 9, 2018
@waylan
waylan deleted the newtests branch January 9, 2018 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants